#include <cmath>
#include <string>
#include <GL/glew.h>

#include <SRL/Utils/LogOut.h>

namespace srl {
    
    // Constructor with out type
    LogOut::LogOut(OutType Output) { output = Output; }
    
    // Write a string
    LogOut& LogOut::operator<<(std::string str) {
        if(output == Console)    printf("%s", str.c_str());
        else if(output == File)  fprintf(stderr, "%s", str.c_str());
        return (*this);
    }
    
    // Write numbers
    LogOut& LogOut::operator<<(int i) {
        if(output == Console)    printf("%i", i);
        else if(output == File)  fprintf(stderr, "%i", i);
        return (*this);
    }
    LogOut& LogOut::operator<<(float f) {
        if(output == Console)    printf("%d", f);
        else if(output == File)  fprintf(stderr, "%d", f);
        return (*this);
    }
    LogOut& LogOut::operator<<(double d) {
        if(output == Console)    printf("%d", d);
        else if(output == File)  fprintf(stderr, "%d", d);
        return (*this);
    }
    
    
    LogOut LogOut::GetInstance(OutType Output) {
        static LogOut currentLog(Output);
        return currentLog;
    }
};
